import type { CodeType, User, UserInfo, Patient, PatientList } from '@/types/user'
import { request } from '@/utils/request'
// 密码登录
export const loginByPassword = (mobile: string, password: string) => {
  return request<User>('login/password', 'POST', { mobile, password })
}

// 发送验证码
export const sendMobileCode = (mobile: string, type: CodeType) => {
  return request('code', 'GET', { mobile, type })
}

// 短信登录
export const loginByMobile = (mobile: string, code: string) => {
  return request<User>('login', 'POST', {
    mobile,
    code
  })
}
// 获取个人信息，订单信息
export const getUserInfo = () => request<UserInfo>('/patient/myUser', 'GET')

// 获取患者档案
export const getPatientList = () => {
  return request<PatientList>('patient/mylist')
}

// 添加患者
export const addPatient = () => {
  return request('patient/add', 'POST', {
    name: '司华胜天',
    idCard: '37252219840316493X',
    defaultFlag: 0,
    gender: 0
  })
}
